# BuildApplication.cmake - Copyright (c) 2019 Tobias Junghans
#
# description: build Veyon application
# usage: BUILD_APPLICATION(<NAME> <SOURCES>)

MACRO(BUILD_APPLICATION APPLICATION_NAME)
	SET(APPLICATION_SOURCES ${ARGN})

	IF(VEYON_BUILD_ANDROID)
		ADD_LIBRARY(${APPLICATION_NAME} SHARED ${APPLICATION_SOURCES})
	ELSE()
		ADD_EXECUTABLE(${APPLICATION_NAME} ${APPLICATION_SOURCES})
		INSTALL(TARGETS ${APPLICATION_NAME} RUNTIME DESTINATION bin)
	ENDIF()
	TARGET_INCLUDE_DIRECTORIES(${APPLICATION_NAME} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_SOURCE_DIR}/src)
	TARGET_LINK_LIBRARIES(${APPLICATION_NAME} veyon-core)
	TARGET_COMPILE_OPTIONS(${APPLICATION_NAME} PRIVATE ${VEYON_COMPILE_OPTIONS})
	SET_DEFAULT_TARGET_PROPERTIES(${APPLICATION_NAME})
ENDMACRO()

